package com.wu.config;

/**
 * @program: blog
 * @author: wulei
 * @create: 2021-11-23 09:55
 */

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * 配置是否启动SSL的https配置
 */
public class SSLCondition implements Condition {

    /**
     * 是否开启ssl认证
     */
    @Value("${server.ssl.enabled}")
    private boolean enabled;

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        return enabled;
    }
}
